/**
    File        : PluginManager.h
    Description : Singleton class for managing all plugins
    Author      : Raymond Marsh
    Created     : 08/01/2009
    Copyright 2009, 2010, 2011, 2012 Raymond Marsh

    This program is distributed under the terms of the GNU General Public License.
    To view a copy of the license see the file 'copying.txt'

    This file is part of the MyMoney Suite.

    MyMoney is free software: you can redistribute it and/or modify it under
    the terms of the GNU General Public License as published by the Free Software Foundation, either
    version 3 of the License, or (at your option) any later version.

    MyMoney is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with MyMoney.
    If not, see <http://www.gnu.org/licenses/>.
**/

#ifndef PLUGINMANAGER_H_INCLUDED
#define PLUGINMANAGER_H_INCLUDED

//(* wxWidgets includes
#include <wx/string.h>
#include <wx/dynlib.h>
#include <wx/arrstr.h>
#include <wx/dir.h>
//*)

//(* C/C++ includes
//*)

//(* other includes
#include "../common/IPlugin.h"
#include "../common/stdafx.h"
#include "ErrorLog.h"
//*)

//(* defines
typedef SPluginInfo                        PLUGIN;
typedef std::vector<SPluginInfo*>          PLUGIN_LIST;
typedef PLUGIN_LIST::iterator              PLUGIN_LIST_ITER;
//*)

//(* constants
const wxString g_strFuncRegister   = "RegisterPlugin";
const wxString g_strFuncUnregister = "UnregisterPlugin";
//*)

namespace
{
    static bool g_IsInit = false;
}

class CPluginManager
{
public:
    CPluginManager();
    ~CPluginManager();
    void Initialize(CMainFrame* pParent);
    int LoadAllPlugins();
    void UnloadAllPlugins();
    CPluginBase* GetPluginByName(const wxString& PluginName);
    wxArrayString GetAvailableAccountPluginNames();

private:
    bool LoadPlugin(const wxString &Filename);

    CMainFrame*                   m_pParent;
    CData*                        m_pData;
    PLUGIN_LIST                   m_PluginList;
};


#endif // PLUGINMANAGER_H_INCLUDED
